/*   Shotscreens
 *   Copyright (C) 2010, Vadim Zakondyrin (http://crystalnix.com)
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef QGRAPHICSBRUSHITEM_H
#define QGRAPHICSBRUSHITEM_H

#include <QGraphicsItemGroup>
#include <QPen>


class QGraphicsBrushItem : public QGraphicsItemGroup
{
public:
    QGraphicsBrushItem(const QPen & pen = QPen(), QGraphicsItem *parent = 0);
    ~QGraphicsBrushItem();

    inline QPen getPen() { return m_pen; }
    void setPen(const QPen & pen);

    void addItemByPointOnScene(const QPointF & point);
    void clearPoints();

    inline virtual QRectF boundingRect() const { return m_boundingRect; }
    void initializeBoundingRect(const QRectF &rect);
    void updateBoundingRect(const QRectF &rect);
    void DelPointByIndex(int index);
    void SetPointByIndex(int index,QPoint point);
    int GetTotalPoints();
    QList<QGraphicsLineItem *> brushPoints;
private:
    QPen m_pen;
    QRectF m_boundingRect;

    void initializeNewPoint(QGraphicsLineItem * point);
};

#endif // QGRAPHICSBRUSHITEM_H
